package com.cf.r1029_e;

import java.io.*;

public class a {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        in.nextToken(); int T = (int) in.nval;
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        in.nextToken(); int x = (int) in.nval;
        int[] a = new int[n];
        int l = -1;
        for (int i = 0; i < n; i++) {
            in.nextToken(); a[i] = (int) in.nval;
            if (l == -1 && a[i] == 1) {
                l = i;
            }
        }
        int r = -1;
        for (int i = n - 1; i >= 0; i--) {
            if (a[i] == 1) {
                r = i;
                break;
            }
        }

        if (l == -1 || r == -1) {
            out.println("YES");
            return;
        }

        out.println(r - l + 1 <= x ? "YES" : "NO");

    }
}
